﻿@model List<TidyBlog.Entity.Category>

@{
	ViewBag.Title = "分类列表";
	Layout = "~/Views/Shared/_ManageLayout.cshtml";
}

<table>
	<thead>
		<tr>
			<th style="width: 7%;">编号</th>
			<th style="width: 15%;">分类名</th>
			<th style="width: 20%;">关键字</th>
			<th style="width: 28%;">描述</th>
			<th style="width: 9%;">文章数</th>
			<th style="width: 9%;">权重</th>
			<th style="width: 12%;">操作</th>
		</tr>
	</thead>
	<tbody>
@if (Model == null || Model.Count <= 0)
{
				<tr>
					<td colspan="6" class="alignCenter">暂无分类</td>
				</tr>
}
else
{
	foreach (var category in Model)
	{
		var routeValues = new { id = category.CategoryId };
				<tr>
					<td style="text-align: center;">@category.CategoryId</td>
					<td><a href="@Url.Action("Index", "Article", routeValues)" target="_blank">@category.CategoryName</a></td>
					<td>@category.Keywords</td>
					<td>@category.Description</td>
					<td style="text-align: center;">@category.PostCount</td>
					<td style="text-align: center;">@category.Weight</td>
					<td style="text-align: center;">
						<a href="@Url.Action("Edit", routeValues)">编辑</a>　
						<a href="@Url.Action("Delete", routeValues)" class="delete-confirm">删除</a>
					</td>
				</tr>
	}
}
			</tbody>
		</table>

@section Script{
<script>
require('dom/1.0.x/', function($) {
	$("a.delete-confirm").click(function (e) {
		if (!window.confirm("确认要删除此分类吗（此操作不可恢复）？")) {
			e.preventDefault();
		}
	});
});
</script>
}